package old_go_learn

import "fmt"

type Humaner interface {
	//方法,只有声明,没有实现,由别的类型(自定义类型)实现
	sayhi()
}

type Student1 struct {
	name string
	id   int
}

func (tmp *Student1) sayhi() {
	fmt.Printf("Student1 [%s , %d] sayhi\n", tmp.name, tmp.id)
}

type Teacher struct {
	addr  string
	group string
}

func (tmp Teacher) sayhi() {
	fmt.Printf("Teacher [%s , %s] sayhi\n", tmp.addr, tmp.group)
}

func main() {
	var i Humaner

	s := &Student1{"mike", 1}
	//i = s
	s.sayhi()

	t := &Teacher{"beijing", "南极光1"}
	i = t
	i.sayhi()

}
